
_realname=sl
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=5.05
pkgrel=1
pkgdesc='Steam Locomotive runs across your terminal when you type "sl" as you meant to type "ls" (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') 
url="https://github.com/eyJhb/sl"
license=('custom')
depends=("${MINGW_PACKAGE_PREFIX}-ncurses")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/eyJhb/sl/archive/${pkgver}/${_realname}-${pkgver}.tar.gz")
sha512sums=('4a57737a60c90a1eec2210ce7c28db937b46a5c35006bd1b5ff43d20ef617a004c49c2b2897ebc0fb8c57b6687fe933b2c9834f5800fdc0bf9912e07542a3b30')

build() {
    cd "sl-$pkgver"
    CFLAGS+=" -Wall -Wextra"
    CPPFLAGS+=" -I${MINGW_PREFIX}/include/ncurses/"
    LDFLAGS+=" -lncursesw"
    cc ${CFLAGS} ${CPPFLAGS} -O3 -o sl sl.c ${LDFLAGS}
    gzip -9 -f sl.1
}


package() {
    cd "sl-$pkgver"

    install -Dm 775 sl "${pkgdir}${MINGW_PREFIX}/bin/sl"
    install -Dm 644 sl.1.gz "${pkgdir}${MINGW_PREFIX}/share/man/man1/sl.1.gz"
    install -Dm 644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}/LICENSE"
}
